/* Firefox userChrome.css tweaks ********************************************************/
/* Github: https://github.com/aris-t2/customcssforfx ************************************/
/****************************************************************************************/

@import "./appbutton_in_titlebar_icon_only.css";

:root {
  --appbutton_in_titlebar: 95px !important;
}

/* gain space before menubar */
#main-window:is([tabsintitlebar],[customtitlebar]) #toolbar-menubar {
  margin-inline-start: var(--appbutton_in_titlebar) !important;
}

#main-window:is([tabsintitlebar],[customtitlebar])[sizemode="maximized"] #toolbar-menubar {
  margin-inline-start: var(--appbutton_in_titlebar) !important;
}

#main-window[uidensity=compact]:is([tabsintitlebar],[customtitlebar]) #toolbar-menubar {
  margin-inline-start: var(--appbutton_in_titlebar) !important;
}

#main-window[uidensity=compact]:is([tabsintitlebar],[customtitlebar])[sizemode="maximized"] #toolbar-menubar {
  margin-inline-start: var(--appbutton_in_titlebar) !important;
}

/* gain space before tabs toolbar */
#main-window:is([tabsintitlebar],[customtitlebar]) #toolbar-menubar[autohide="true"][inactive="true"] ~ #TabsToolbar{
  padding-inline-start: var(--appbutton_in_titlebar) !important;
}

#main-window:is([tabsintitlebar],[customtitlebar])[sizemode="maximized"] #toolbar-menubar[autohide="true"][inactive="true"] ~ #TabsToolbar{
  padding-inline-start: var(--appbutton_in_titlebar) !important;
}

#main-window[uidensity=compact]:is([tabsintitlebar],[customtitlebar]) #toolbar-menubar[autohide="true"][inactive="true"] ~ #TabsToolbar{
  padding-inline-start: var(--appbutton_in_titlebar) !important;
}

#main-window[uidensity=compact]:is([tabsintitlebar],[customtitlebar])[sizemode="maximized"] #toolbar-menubar[autohide="true"][inactive="true"] ~ #TabsToolbar{
  padding-inline-start: var(--appbutton_in_titlebar) !important;
}

#main-window:is([tabsintitlebar],[customtitlebar])[sizemode="fullscreen"] #TabsToolbar {
 padding-inline-start: var(--appbutton_in_titlebar) !important;
}

#main-window:is([tabsintitlebar],[customtitlebar]) #PanelUI-button #PanelUI-menu-button {
  background-clip: padding-box !important;
  width: 90px !important;
}

#main-window:is([tabsintitlebar],[customtitlebar]) #PanelUI-button .toolbarbutton-icon {
  margin-inline-start: -16px !important;
}

#main-window:is([tabsintitlebar],[customtitlebar]) #PanelUI-menu-button::after {
  display: block !important;
  color: white !important;
  font-weight: bold !important;
  text-shadow: 0 0 1px rgba(0,0,0,.7),
			   0 1px 1.5px rgba(0,0,0,.5) !important;
  margin-top: 0px !important;
  margin-bottom: 2px !important;
  border: unset !important;
  box-shadow: unset !important;
}


/* 'Firefox' title */
#main-window:is([tabsintitlebar],[customtitlebar]) #PanelUI-menu-button[label="Firefox"]::after,
#main-window:is([tabsintitlebar],[customtitlebar]) #PanelUI-menu-button:not([label="Nightly"],[label="Firefox Nightly"],[label="Firefox Developer Edition"],[label="Firefox"],[label="Tor Browser"],[label="Tor-Browser"])::after {
  content: "Firefox" !important;
}

/* 'DevFox' title */
#main-window:is([tabsintitlebar],[customtitlebar]) #PanelUI-menu-button[label="Firefox Developer Edition"]::after {
  content: "DevFox" !important;
}

/* 'Nightly' title */
#main-window:is([tabsintitlebar],[customtitlebar]) #PanelUI-menu-button:is([label="Nightly"],[label="Firefox Nightly"])::after {
  content: "Nightly" !important;
}

/* 'Tor-Browser' title */
#main-window:is([tabsintitlebar],[customtitlebar]) #PanelUI-menu-button:-moz-any([label="Tor Browser"],[label="Tor-Browser"])::after {
  content: "TorFox" !important;
}

/* support for tab title in Firefox titlebar option*/
#main-window:is([tabsintitlebar],[customtitlebar])::after {
  margin-inline-start: var(--appbutton_in_titlebar) !important;
}

/* Force appbutton to the right */
@media (-moz-platform: macos) {
	
	#main-window:is([tabsintitlebar],[customtitlebar]) #PanelUI-button {
	  right: 0 !important;
	}

	#main-window:is([tabsintitlebar],[customtitlebar]) #TabsToolbar {
	  padding-inline-end: calc(var(--appbutton_in_titlebar) + 5px) !important;
	}

	#main-window:is([tabsintitlebar],[customtitlebar]) .titlebar-buttonbox-container {
	  padding-inline-end: 20px !important;
	}

}

